import { TokenState } from "@/types/data"
import { LoginAction } from "@/types/store"
import { getToken } from "@/utils/token"
const intitalState: TokenState = getToken()
export default function login (state = intitalState, action: LoginAction): TokenState {
  switch (action.type) {
      case "login/token":
        return action.payload
      case 'login/logout':
          return intitalState;
      default:
        return state
  }
}